---
description:
  Schema coverage is based on documents. Find out how many times types and fields are used in your
  application.
---

# Coverage (Documents & Schema)

Schema coverage is based on documents. Find out how many times types and fields are used in your
application.

![Coverage](/assets/img/cli/coverage.png)

## Coverage - Usage

Run the following command:

```sh
graphql-inspector coverage DOCUMENTS SCHEMA
```

## Arguments

- [`DOCUMENTS`](../api/documents) - a glob pattern that points to GraphQL Documents / Operations
- [`SCHEMA`](../api/schema) - point to a schema

## Flags

- `-s, --silent`- Do not render any stats in the terminal (default: `false`)
- `-w, --write <s>` - Write a file with coverage stats (_disabled by default_)
- `-d, --deprecated` - Fail on deprecated usage (default: `false`)
- `-r, --require <s>` - require a module
- `-t, --token <s>` - an access token
- `-h, --header <s>` - set http header (`--header 'Auth: Basic 123'`)
- `--method` - method on url schema pointers (default: `POST`)
- `--federation` - Support Apollo Federation V1 directives (default: `false`)
- `--federationV2` - Support Apollo Federation V2 directives (default: `false`)
- `--aws` - Support AWS Appsync directives and scalar types (default: `false`)

## Output

Depending on enabled flags, a printed GraphQL Schema with stats per each field and overall stats, a
JSON file with data.

## Examples

Compare your local schema against a remote server:

```sh
graphql-inspector coverage example/documents/post.graphql example/schemas/new-valid.graphql
```

## Statistics

- Types covered: This shows the percentage of types in your schema that have been covered by your
  tests. In your case, you have achieved 100% coverage for types, which means that all types in your
  schema have been tested.
- Types covered fully: This shows the percentage of types that have been fully covered by your
  tests, meaning that all fields in those types have been tested. In your case, you have not
  achieved 100% coverage for fully covered types, as the percentage is at 0%.
- Fields covered: This shows the percentage of fields in your schema that have been covered by your
  tests. In your case, you have achieved 50% coverage for fields, which means that only half of the
  fields in your schema have been tested.
- Total Queries: This shows the total number of queries in your schema that have been tested.
- Total Mutations: This shows the total number of mutations in your schema that have been tested.
- Total Subscriptions: This shows the total number of subscriptions in your schema that have been
  tested.

![CoverageStats](/assets/img/cli/coverageStats.png)
